package com.yvon.service.demo.design.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author Yvon
 * @since 2022/12/19
 */
public class CarInvocationHandler implements InvocationHandler {

    final private Car car;

    public CarInvocationHandler(Car car) {
        this.car = car;
    }


    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("----before----");
        Object invoke = method.invoke(car, args);
        System.out.println("-----after----");
        return invoke;
    }
}
